package com.handu.luna.core.domain.admin;

import java.time.ZonedDateTime;

import javax.persistence.Entity;

import com.handu.luna.core.domain.BasePersistentDomain;

@Entity
public class WorkLog extends BasePersistentDomain<WorkLogRepository>{
	
	private String operatorName;
	private long operatorId;
	private ZonedDateTime operateTime;
	private String ip;
	private String content;
	private String url;
	private String method;
	
	public WorkLog(){}

	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getMethod() {
		return method;
	}
	public void setMethod(String method) {
		this.method = method;
	}
	public String getOperatorName() {
		return operatorName;
	}
	public void setOperatorName(String operatorName) {
		this.operatorName = operatorName;
	}
	public long getOperatorId() {
		return operatorId;
	}
	public void setOperatorId(long operatorId) {
		this.operatorId = operatorId;
	}
	public ZonedDateTime getOperateTime() {
		return operateTime;
	}
	public void setOperateTime(ZonedDateTime operateTime) {
		this.operateTime = operateTime;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}

	public WorkLog(String operatorName, long operatorId,
			String ip, String content, String url,
			String method) {
		super();
		this.operatorName = operatorName;
		this.operatorId = operatorId;
		this.operateTime = ZonedDateTime.now();
		this.ip = ip;
		this.content = content;
		this.url = url;
		this.method = method;
	}
	
	public void log(String operatorName, long operatorId, String ip,String content, String url,
			String method){
		context.getWorkLogRepository().save(new WorkLog(operatorName, operatorId, ip,content, url,method));
	}
	
	public void log(String operatorName, long operatorId, String ip,String content){
		log(operatorName, operatorId, ip,content,"","");
	}
}
